import { lazy } from "react";
import { createBrowserRouter } from "react-router-dom";
import App from "../App";
const Home=lazy(()=>import('../Page/Home'))
const Order=lazy(()=>import('../Page/Order'))
const My=lazy(()=>import('../Page/My'))
const Message=lazy(()=>import('../Page/Message'))
const Detail=lazy(()=>import('../Page/Detail'))
const Login=lazy(()=>import('../Page/Login'))


export const routeshome=[
    {
       path:'/home/order',
       element:<Order></Order>,
       title:'订单'
    },
    {
        path:'/home/my',
        element:<My></My>,
        title:'我的'
    },
    {
        path:'/home/message',
        element:<Message></Message>,
        title:'消息'
    },
]

const routes=createBrowserRouter([
    {
        index:true,
        element:<App></App>,
    },
    {
        path:'/home',
        element:<Home></Home>,
        children:routeshome
    },
    {
        path:'/detail/:id',
        element:<Detail></Detail>
    },
    {
        path:'/login',
        element:<Login></Login>

    }
])
export default routes